package com.kexun.common.utils;

public class Result {

    private int code;

    private String message;

    private Object data;


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public Result(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Result(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result() {
    }

    public static Result success() {
        return new Result(0, "ok", null);
    }

    public static Result success(String message) {
        return new Result(0, message, null);
    }

    public static Result success(String message, Object data) {
        return new Result(0, message, data);
    }


    public static Result error() {
        return new Result(500, "error", null);
    }

    public static Result error(String message) {
        return new Result(500, message, null);
    }

    public static Result error(String message, Object data) {
        return new Result(500, message, data);
    }


}
